package com.resign.carl.state.api.impl;

import com.resign.carl.state.api.GumballMachine;
import com.resign.carl.state.api.State;

/**
 * 待出售
 * Created by carl.zhao on 2016/6/17.
 */
public class NoQuarterState implements State {
    private GumballMachine gumballMachine;
    public NoQuarterState(GumballMachine gumballMachine){
        this.gumballMachine = gumballMachine;
    }
    @Override
    public void insertQuarter() {
        System.out.println("You insert a quarter");
        gumballMachine.setState(gumballMachine.getHasQuarterState());
    }

    @Override
    public void ejectQuarter() {
        System.out.println("You haven't insert a quarter");
    }

    @Override
    public void turnCrank() {
        System.out.println("You turned, but there's no quarter");
    }

    @Override
    public void dispense() {
        System.out.println("You need to pay first");
    }
}
